<!DOCTYPE html>
<?php

require_once ('conn.php');
require_once ('top.php');
if($_SESSION['role']==1){
      Header("Location:index.php"); 
    }elseif($_SESSION['role']==3){
           Header("Location:dotlistMaster.php"); 
   }
$contactNumber = $_GET['contactNumber'];
$ci_contact = mysql_fetch_row(mysql_query("select id,name from ci_contact where number ='$contactNumber'"));
?>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>优易购</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <link rel="stylesheet" href="css/jquery.lineProgressbar.css">
    <link rel="stylesheet" href="css/checkbox_radio_bootstrap.css">
    <script src="js/jquery-1.11.0.min.js"></script>
    <script src="js/jquery.lineProgressbar.js"></script>
</head>
<body>
    <div class="top">
        <span onclick="javascript:history.go(-1);" class="fanhui">返回</span>
        <span><?=$ci_contact[1]?></span>
        <div class="tright"><span class="outlogin">退出登陆</span></div>
    </div>
    <form action="pandianpost.php?contactNumber=<?=$contactNumber?>" name="pandian" id="pandian" method="post">
    <?php
    $result=mysql_query("select * from ci_wdgoods where contactNumber='".$contactNumber."'"); 
    $i=0;
    $but=0;
    while($row=mysql_fetch_array($result)) 
    {
     $good = mysql_fetch_row(mysql_query("select id,name,unitName from ci_goods where number='".$row['goodsNumber']."'"));
     $url  = mysql_fetch_row(mysql_query("select url from ci_goods_img where invId=$good[0]"));
        
    ?>
    <div class="list3" style="width:94vw;">
        <div class="list100">
            <div class="goods">
                <img src="<?=$url[0]?>" alt="">
                <span class="goodname"><?=$good[1]?></span><br>
                <span class="goodnum">尚有
                
                <input type="text" readonly unselectable="on" name="<?=$good[0]?>" style="height: 25px;line-height: 25px;border-style: none;" class="goodnum2 value1<?=$row['id']?>" value="0"/>
                <input type="text" onkeyup="this.value=this.value.replace(/\D/g,'')" name="<?=$good[0]?>" onafterpaste="this.value=this.value.replace(/\D/g,'')"  class="value2<?=$row['id']?>" style="height: 25px;line-height: 25px;" >
                 <?=$good[2]?>
                </span>
               <label class="checkbox" style="margin-left:80px;">
                    <input id="gid<?=$good[0]?>" type="checkbox" class="all">
                    <i class="fa fa-2x icon-checkbox" style=" bottom:20px;">
                        <input type=hidden value="<?=$row['id']?>">
                    </i>
               </label>
               
            </div>
        </div>
    </div>
   <?php
    $i++;
    }
    ?>
    
                <label class="checkbox" style="margin-right:50px;float:right">
                   全部确认
                    <input id="all" type="checkbox">
                    <i class="fa fa-2x icon-checkbox"  style=" bottom:20px;">
                        <input type=hidden value="<?=$row['id']?>">
                    </i>
               </label>
   <div style=" width:100%;height:100px; float:left;"></div>
    <div  onClick="tijiao()" class="goodsfootbut" >全部盘点</div>
    
     
</form>
</body>
<script src="js/outlogin.js"></script>
<script type="text/javascript">
    function tijiao(){
       var checked = $('.all:checkbox:checked').length;//确认的数量
          if(checked==<?=$i?>){
                $("#pandian").submit();
          }else{
               alert('还有没盘点的商品');
          }
       
    }
    
    
    
   
    
    $("#all").click(function(){
       
        if(this.checked){   
        $(".all:checkbox").prop("checked", true);  
        }else{   
        $(".all:checkbox").prop("checked", false);
        }
        
     });
    
    
    $(".icon-checkbox").click(function(){
       var id    = $(this).children('input').val();
       var value = $(".value2"+id).val();//输入的值
       $(".value1"+id).toggle();
       $(".value2"+id).toggle();
        if(value==""){
            $(".value1"+id).val(0);
       }else{
           $(".value1"+id).val(value);
           
       }
       
      
       
    });
</script>
</html>